Skip to content

Derusting assignment#4

Open
AAshGray wants to merge 2 commits intogrc-cohort-21:mainfrom
AAshGray:main
Open

Derusting assignment#4
AAshGray wants to merge 2 commits intogrc-cohort-21:mainfrom
AAshGray:main

Conversation

@AAshGray
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@auberonedu auberonedu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! In the future, please make more frequent commits. We want a commit every time we've got a small, meaningful set of changes. For this assignment, that would mean probably at least one commit per practice file. Thanks!

Comment thread src/ListPractice.java

public static void main(String[] args) {
// Create an empty ArrayList of Strings and assign it to a variable of type List
ArrayList<String> list = new ArrayList<>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to use interface types where appropriate (Map)

Comment thread src/MapPractice.java
// Create a HashMap with String keys and Integer values and
// assign it to a variable of type Map

HashMap<String, Integer> map = new HashMap<>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to use interface types where appropriate (Map)

Comment thread src/MapPractice.java
Comment on lines +50 to +52
for (String string : map.keySet()) {
System.out.println(string + "=" + map.get(string));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works! Can you search to find another way to iterate over the entries directly, so you you don't need to repeatedly call get?

Comment thread src/SetPractice.java
public class SetPractice {
public static void main(String[] args) {
// Create a HashSet of Strings and assign it to a variable of type Set
HashSet<String> set = new HashSet<String>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to use interface types (Set)

Comment thread src/StringPractice.java
System.out.println(string.charAt(i));
}
// Create an ArrayList of Strings and assign it to a variable
ArrayList<String> stringArray = new ArrayList<>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to use interface types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants